package com.gopay.common.cps.dao.cbrmb.impl;

import com.gopay.common.base.dao.impl.BaseDAOImpl;
import com.gopay.common.cps.dao.cbrmb.CbRmbBatchImportAssistDAO;
import com.gopay.common.domain.cbrmb.CbRmbBatchImportAssist;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;

/**
 * 跨境人民币进口批量支付辅助表DAO 实现类
 * @CbRmbBatchImportAssistDAOImpl.java
 * @author b.zou
 * @Date 2017-8-25
 */
@Repository(value="cbRmbBatchImportAssistDAO")
public class CbRmbBatchImportAssistDAOImpl extends BaseDAOImpl<CbRmbBatchImportAssist, String>
        implements CbRmbBatchImportAssistDAO {
    @Override
    public CbRmbBatchImportAssist getByOrderIdAndIntTxnCd(String orderId, String intTxnCd) {
        String hql = " from CbRmbBatchImportAssist t where t.gopayOrderId =:orderId and t.gopayIntTxnCd =:intTxnCd ";
        HashMap<String, Object> map = new HashMap<String, Object>();
        map.put("orderId", orderId);
        map.put("intTxnCd", intTxnCd);
        List<CbRmbBatchImportAssist> ss = findByHql(hql, map);
        return (null == ss || 0 == ss.size()) ? null : ss.get(0);
    }
}
